<!-- 2024/11/29 生产管理-生产工单-改制详情 按钮弹框 -->
<template>
  <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body @close="cancel">
    <el-table v-loading="loading" :data="remakeDetailList" row-key="workorderId" default-expand-all
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" height="calc(100vh - 310px)"
      @current-change="handleCurrentChange">
      <el-table-column label="原工单编号" min-width="150" align="center" prop="oldWorkorderCode" />
      <el-table-column label="原工单-SN码" min-width="150" align="center" prop="oldSnCode" />
      <el-table-column label="改制工单编号" min-width="150" align="center" prop="remakeWorkorderCode" />
      <el-table-column label="改制工单-SN码" min-width="150" align="center" prop="remakeSnCode" />
      <el-table-column label="改制人" min-width="80" align="center" prop="createBy" />
      <el-table-column label="改制时间" min-width="150" align="center" prop="createTime" />
    </el-table>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">关 闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { remakeDetail } from "@/api/mes/pro/workorder";
export default {
  name: "finishedProductReformInfo",
  data() {
    return {
      title: "成品改制-改制详情",
      open: false,
      rowInfo: {},
      stepIndex: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10000,
      },
      total: 0,
      loading: true,
      remakeDetailList: [],
    };
  },
  methods: {
    //初始化函数
    init(row) {
      this.rowInfo = row
      this.open = true;
      this.getList();
    },
    /** 查询生产工单列表 */
    getList() {
      if (!this.rowInfo['workorderId']) {
        return false
      }
      this.loading = true;
      remakeDetail({ ...this.queryParams, remakeWorkorderId: this.rowInfo.workorderId }).then((res) => {
        console.info(res)
        this.remakeDetailList = res.rows
        this.total = res.total;
        this.loading = false;
      }).catch(() => {
        this.loading = false;
      });
    },

    /* 取消按钮 */
    cancel() {
      this.open = false;
      this.remakeDetailList = []
    },
  }
}
</script>
<style lang='scss' scoped>
.dialog-footer {
  padding-top: 20px;
  text-align: center;
}

.sn-title {
  background-color: #ddd;
  padding: 10px;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.sn-title :deep(.el-checkbox .el-checkbox__label) {
  color: #fff !important;
}
</style>